package com.da.springtest.ioc.inject;

import org.springframework.context.support.ClassPathXmlApplicationContext;

/**
 * @author chenlida
 * @date 2020/6/13 21:52
 * @description
 */
public class TestMethod {
    public static void main(String[] args) {
        //1.bean配置文件位置
        String beanXml = "classpath:bean/beanInject.xml";
        //2.创建ClassPathXmlApplicationContext容器，给容器指定需要加载的bean配置文件
        ClassPathXmlApplicationContext context = new ClassPathXmlApplicationContext(beanXml);
        System.out.println(context.getBean("diByConstructorParamName"));
        System.out.println(context.getBean("diBySetter"));

        System.out.println("------------------------------");

        System.out.println(context.getBean("diBeanByConstructor"));
        System.out.println(context.getBean("diBeanBySetter"));

        System.out.println("------------------------------");
        System.out.println(context.getBean("diOtherType"));
    }
}
